package panels;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JCheckBox;
import javax.swing.table.TableCellRenderer;

public class CheckBoxRenderer extends JCheckBox implements TableCellRenderer {
	public CheckBoxRenderer() {
		super();
	}

	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean focus, int row, int column) {
		if (value instanceof Boolean)
			this.setSelected(((Boolean) value).booleanValue());
		else
			this.setSelected(false);
		if (isSelected) {
			super.setForeground(table.getSelectionForeground());
			super.setBackground(table.getSelectionBackground());
		} else {
			super.setForeground(table.getForeground());
			super.setBackground(table.getBackground());
		}
		return this;
	}
}
